<template>
  <div class="login">
    <header>
      <router-link to="/rigster"><span>注册</span></router-link>
    </header>

    <main>
      <!-- <b>手机快捷登陆</b> -->
      <!-- <img src="@/assets/rigster.png" alt="" />  -->
      账号<input
        type="text"
        class="user"
        placeholder="请输入手机号"
        v-model.lazy.trim="user"
      />
      <br />密码<input
        type="text"
        class="user"
        placeholder="请输入密码"
        v-model.lazy.trim="psw"
      />

      <div class="deng">
        <router-link to="/home">
          <van-button
            round
            block
            type="primary"
            native-type="submit"
            class="but"
            @click="submit()"
          >
            登录
          </van-button>
        </router-link>
      </div>
    </main>
  </div>
</template>

<script>
export default {
  data() {
    return {
      user: "",
      psw: "",
    };
  },
  methods: {
     submit(){
localStorage.setItem("user", this.user);
},
 },
    // submit() {
    //   let reg = /^1[3|4|5|6|7|8|9]\d{9}$/;
    //   if (
    //     this.user == "" ||
    //     (!reg.test(this.user) && this.psw == "") ||
    //     !reg.test(this.psw)
    //   ) {
    //     this.$message.error("手机号不能为空/输入不合法");
    //     return;
    //   }
    //   if (reg.test(this.user) && reg.test(this.psw)) {
    //     this.$message({
    //       message: "恭喜你，登陆成功！",
    //     });
    //     this.denglu()
    //   }
    // },
    // denglu(){
    //   let str={text1:this.user}
    //   if(!str==""){
    //     localStorage.setItem("text1", this.user);
    //   }
    // }
  
};
</script>

<style scoped>
.login {
  background-color: #fff;
  height: 6.5rem;
}
header {
  height: 0.5rem;
  border-bottom: 1px solid #999;
  /* background-color: antiquewhite; */
}
header span {
  line-height: 0.5rem;
  margin-left: 88%;
}
main {
  /* background-color: aquamarine; */
  min-height: 3rem;
  width: 90%;
  margin: 0.4rem auto;
  text-align: center;
}
main b {
  font-size: 0.3rem;
  font-weight: 800;
}
main a {
  font-size: 0.14rem;
  color: #999;
  margin-top: 0.15rem;
  display: flex;
  margin-left: 0.8rem;
}
.van-form {
  margin-top: 0.2rem;
}
.xieyi span {
  font-size: 0.12rem;
  color: #999;
}
main img {
  width: 1.7rem;
  height: 0.33rem;
  display: flex;
  margin: 0.8rem auto;
}
.deng {
  margin-top: 50px;
  background-color: #c03131;
  border-radius: 0.05rem;
}
.but {
  background-color: #c03131;
  border: 0;
  margin-left: -0.3rem;
}
.user,
.again {
  width: 80%;
  height: 0.5rem;
  border-bottom: 1px solid #999;
  font-size: 0.13rem;
  text-indent: 2em;
}
.again {
  width: 80%;
  text-indent: 2em;
  margin-left: 0.3rem;
}
</style>